﻿using cio.trpl.wcf.service.protobuf.pocos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using cio.trpl.wcf.dal;


namespace cio.trpl.wcf.service.protobuf
{
	public class TrplServices : ITrplServices
	{
		[OperationContract]
		public TRPLRiskBucket[] GetTrplBucketedRiskPositions(DateTime effectiveDate)
		{
			TRPLRiskBucket[] res = null;

			TrplDataAccess dal = new TrplDataAccess();
			res = dal.GetTrplBucketedRiskPositions(new DateTime(2015, 2, 13)).Select
					( 
						p => new TRPLRiskBucket() 
									{ 
										
										id_risk_bucket		= p.id_risk_bucket	,
										effective_date 		= p.effective_date 	,
										region 				= p.region 			,
										lob 				= p.lob 			,
										portfolio 			= p.portfolio 		,
										strategy 			= p.strategy 		,
										sub_portfolio 		= p.sub_portfolio 	,
										product 			= p.product 		,
										ccy 				= p.ccy 			,
										risk_curve_type		= p.risk_curve_type	,
										risk_curve_name		= p.risk_curve_name	,
										tenor_name 			= p.tenor_name 		,
										dv01 				= p.dv01 			,
										curve 				= p.curve 			,
										dvdf 				= p.dvdf 			,
										cluster 			= p.cluster 		
									}
					).ToArray();

			return res;
		}
	}
}
